package edu.towson.greenteam.comment;
import junit.framework.Assert;
import org.junit.Test;


public class commentTest 
{
	public void testComment() {
		Comment comment = new Comment(1);
		comment.setCustName("Mary");
		comment.setContent("Is Mad");
		Assert.assertEquals(comment.getCustName(), "Mary");
		Assert.assertEquals(comment.getContent(), "Is Mad");
		Assert.assertEquals(comment.isVisible(), false);
		Assert.assertEquals(comment.isReviewed(), false);
		comment.setVisible(true);
		comment.setReviewed(true);
		Assert.assertEquals(comment.isVisible(), true);
		Assert.assertEquals(comment.isReviewed(), true);
	}	
	
	@Test
	public void TestCCNotReviewedItr() {
		Comment commentOne = new Comment(1);
		commentOne.setContent("notreviewed");
		commentOne.setReviewed(false);
		
		Comment commentTwo = new Comment(2);
		commentTwo.setContent("reviewed");
		commentTwo.setReviewed(true);
		
		Comment commentThree = new Comment(3);
		commentThree.setContent("reviewed");
		commentThree.setReviewed(true);
		
		//create Comments
		Comments comments = new Comments();
		comments.add(commentOne);
		comments.add(commentTwo);
		comments.add(commentThree);
		
		CCNotReviewedItr itr = new CCNotReviewedItr(comments);
		while (itr.hasNext())
		{
			Comment currentComment = itr.next();
			if (currentComment != null)
			{
				Assert.assertEquals(currentComment.isReviewed(), false);;
				Assert.assertEquals(currentComment.getContent(), "notreviewed");
			}
		}	
	}
	
	public void testCCVisibleItr() {
		Comment commentOne = new Comment(1);
		commentOne.setContent("notvisible");
		commentOne.setVisible(false);
		
		Comment commentTwo = new Comment(2);
		commentTwo.setContent("visible");
		commentTwo.setVisible(true);
		
		Comment commentThree = new Comment(3);
		commentThree.setContent("visible");
		commentThree.setVisible(true);
		
		//create Comments
		Comments comments = new Comments();
		comments.add(commentOne);
		comments.add(commentTwo);
		comments.add(commentThree);
		
		CCVisibleItr itr = new CCVisibleItr(comments);
		while (itr.hasNext())
		{
			Comment currentComment = itr.next();
			Assert.assertEquals(currentComment.isVisible(), false);;
			Assert.assertEquals(currentComment.getContent(), "notvisible");
		}	
	}

	@Test
	public void testCommentCreation() {
		Comment cmt = new Comment(0, "Best meal ever", "maria");
		Assert.assertNotNull("Object is not null", cmt);
	}
	
	@Test
	public void testGetComment() {
		Comment cmt = new Comment(1, "It was ok", "minnie mouse");
		Assert.assertEquals(cmt, cmt.getComment());
	}
	
	@Test
	public void testVisible() {
		Comment cmt = new Comment(2, "Yummy", "c3p0");
		cmt.setVisible(true);
		Assert.assertEquals(true, cmt.isVisible());
	}
	
	@Test
	public void testReviewed() {
		Comment cmt = new Comment(3, "Delicious food", "darth");
		cmt.setReviewed(true);
		Assert.assertEquals(true, cmt.isReviewed());
	}
	
}
